﻿<phone:PhoneApplicationPage 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
	x:Class="DeeWeibo.ImageShow"
	FontFamily="{StaticResource PhoneFontFamilyNormal}"
	FontSize="{StaticResource PhoneFontSizeNormal}"
	Foreground="{StaticResource PhoneForegroundBrush}"
	Orientation="Portrait"
	shell:SystemTray.IsVisible="True"
    Loaded="PhoneApplicationPage_Loaded"
    xmlns:ImageTools="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls"
    DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <phone:PhoneApplicationPage.Resources>
        <ImageTools:ImageConverter x:Key="ImageConverter"/>
    </phone:PhoneApplicationPage.Resources>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True">
            <shell:ApplicationBar.MenuItems>
            </shell:ApplicationBar.MenuItems>
            <shell:ApplicationBarIconButton x:Name="RestoreIconButton" IconUri="/Resources/Icons/appbar_turnleft.png" Text="还原" Click="RestoreIconButton_Click"/>
            <shell:ApplicationBarIconButton x:Name="SaveIconButton" IconUri="/Resources/Icons/appbar_Save.png" Text="保存" Click="SaveIconButton_Click"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Width="480" Height="720">
            <ImageTools:AnimatedImage x:Name="GifShow" RenderTransformOrigin="0.5,0.5"
                                      Source="{Binding GifPicShow, Converter={StaticResource ImageConverter}}" 
                                      SizeChanged="GifShow_SizeChanged" HorizontalAlignment="Center" VerticalAlignment="Center">
                <ImageTools:AnimatedImage.RenderTransform>
                    <CompositeTransform x:Name="transformgif"/>
                </ImageTools:AnimatedImage.RenderTransform>
                <toolkit:GestureService.GestureListener>
                    <toolkit:GestureListener 
                        Tap="OnTapGif" Hold="OnHoldGif" DoubleTap="OnDoubleTapGif"
                        DragStarted="OnDragStartedGif" DragDelta="OnDragDeltaGif" 
                        DragCompleted="OnDragCompletedGif"
                        Flick="OnFlickGif"
                        PinchStarted="OnPinchStartedGif" PinchDelta="OnPinchDeltaGif" 
                        PinchCompleted="OnPinchCompletedGif"/>
                </toolkit:GestureService.GestureListener>
            </ImageTools:AnimatedImage>
            <Image x:Name="orgPic"  
                       SizeChanged="orgPic_SizeChanged" 
                       RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center" VerticalAlignment="Center">
                <Image.RenderTransform>
                    <CompositeTransform x:Name="transform"/>
                </Image.RenderTransform>
                <toolkit:GestureService.GestureListener>
                    <toolkit:GestureListener 
                        Tap="OnTap" Hold="OnHold" DoubleTap="OnDoubleTap"
                        DragStarted="OnDragStarted" DragDelta="OnDragDelta" 
                        DragCompleted="OnDragCompleted"
                        Flick="OnFlick"
                        PinchStarted="OnPinchStarted" PinchDelta="OnPinchDelta" 
                        PinchCompleted="OnPinchCompleted"/>
                </toolkit:GestureService.GestureListener>
            </Image>
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>